AL CS 题目总结

记录A-Level CS真题中的知识点与总结

PART ONE:理论基础

第一章:数据的表示

Analogue data: Data values that are variable.


* File header of a bitmapped image is:

  • Data about the bitmap image


扩展到所有file header的题目:file header可以是 “Data about the [file type here]“.



* The image is scanned with an image resolution of 1024 × 512 pixels and a colour depth of 8 bits per pixel.
Calculate an estimate for the file size, giving your answer in mebibytes. Show your working

  • 1024 × 512 × 8 = 524288 × 8 = 4194304 bit

    4194304 bit = 524288 byte = 512 KiB = 0.5 MiB

出现没有给出像素存储大小的题目,默认为一个字节。


byte, kilobyte, megabyte, gigabyte (或者Byte, KB, MB, GB)以1000一进位。

而byte, kibibyte, mebibyte, gibibyte (或者Byte, KiB, MiB, GiB)以1024一进位。

上题中的换算过程中,除的就是1024。



BCD的设计之初就是使用4个bit表示一个0-9的数字,一般来说用来进行高精度运算,或者显示使用。
所以说判断一个数字无法使用BCD来表示,要么就是这个数字大于9,要么就是把一个byte拆成两个nibble发现每一个nibble的大小都大于9。

One’s complement不需要再反转每一位后再加一。



* Identify one method of lossless compression that can be used to compress the bitmap image and describe how the method will > reduce the file size.

  • Use Run-length coding

  • Replace sequences of the same colour pixel with colour code and number of identical pixels.


后来发现实际上Run-length coding也可以被用于压缩位图。

拓展到所有的题目,run-length coding就可以这样作答:

Replace sequences of the same [element] with that character and a number of identical [elements].

其中的[element]替换为文件中重复的内容。比如重复的字符。



Character Set

ASCII can represent 128 characters.

7 bits → 27 = 128

Extended ASCII can represent 256 characters.

8 bits → 28 = 256


* Describe what is meant by a character set:

  • All the characters that the computer can use or represent
  • Each character has a unique binary number



Binary Coded Decimal(BCD)

* State benefits of using Binary Coded Decimal(BCD) to represent values.

  • straightforward to convert between BCD and denary numbers
  • … less complex for programmers to decode and encode
  • easier for digital equipment to display output information
  • can represent monetary values exactly



Overflow

* State how an overflow can occur when adding two binary integers.

  • The result is a larger number than can be stored in the given number of bits.
  • The result is greater than 255



Vector graphs

Property: data about the shapes
Drawing list: the list which stores the command required to draw each object



Wave files

* Describe reasons why sound is closer to the original when higher sample rate is used

  • Smaller time gaps between samples
  • Makes the digital sound more accurate
  • Smaller quantisation errors

最后这条是个采分点,一定要加上。



Compression

* Why RLE may not reduce the file size of a bitmap image?

  • RLE stores a colour and the number of times it occurs consecutively
  • An image may not have many sequences of the same colour
  • It would need to store the colour and the number of repeat so an extra 1 is added to non-consecutive pixels.



第二章:通信与网络技术

P2P

* Describe the key features of a peer-to-peer network

  • All computers are of equal status
  • Each computer provides access to resources and data
    …or / data is distributed

  • Computers can communicate and share resources

  • Each computer is responsible for its own security


* Describe drawbacks of the peer-to-peer network:

  • Reduced security / no central management of security
    …only as secure as the weakest computer on the network
    …each computer is at risk from viruses from other computers

  • No central management of backup
    …if the data from one computer is not backed up it is lost to all of the computers

  • No central management of files/software
    …consistency may be difficult to maintain
    …each computer may have different software from the others

  • Individual computers may respond slower
    …because they can be accessed by other computers

  • The connection can only be established if all the involved computers has to be switched on.
    …so the files may not be always available



Mesh network

* What is a mesh topology?

  • All computers directly connected to at least one other device
  • There are multiple routes to get to the destination
  • Computers acts as relays


* Give advantages of using mesh topology.

  • If a line or a node goes down there are other available routes
  • Improved security as data is not being sent over a dedicated connection or a single line (bus)
  • New nodes can be added without interference with current nodes
  • No collisions



Subnetting

* Describe reasons why subnetting is used in a network

  • To improve the security of the LAN

    • so that devices will not receive unintended data
  • To make the network management easier

    • because faults can be isolated more efficiently
  • To improve the network performance

    • by dividing data between local segments

IP Addresses

IPV4:

  • Contains 4 groups of digits
  • Each group is represented in 8 bits
  • Separated by Full stops

IPV6:

  • Contains 6 groups of digits
  • Each group is represented in 16 bits
  • Separated by ::



CSMA/CD

  • A workstation listens to the communication channel
  • … data is only sent when the channel is free
  • Because there is more than one computer connected to the same transmission medium
  • … two workstations can start to transmit at the same time, causing a collision
  • If collision happens, the workstations send a jamming signal
  • … and each waits a random amount of time before attempting to resend



Router

* The router has a wireless access point (WAP) to allow the devices to connect wirelessly.
Identify three functions of the router in this network.

  • To receive packets from the devices or Internet
  • To route the packets to their destination
  • To find the destination of the packets
  • To assign private IP addresses to devices on LAN
  • To store a routing table
  • To find a most efficient path to the destination
  • To maintain a table of MAC and IP addresses




Hub directs each packet to all devices attached to it.



Cloud computing

Accessing a service/files/software on a remote server.

* Give some advantages and disadvantages of accessing both > software and data using cloud computing.

Advantages:

  • Cloud storage can be free (for small quantities)
  • Can access data from any computer with an Internet access
  • Data can be easily shared
  • Security could be better

Disadvantages:

  • Can only access the cloud when there is an Internet access
  • It takes time to download or upload data when needed
  • It could be more expensive in the long term

* State what is meant by a public cloud and a private cloud.

  • Public cloud

    • Computing services offered by 3rd party provider over the public Internet
    • Available to anyone with the appropriate equipment
  • Private cloud

    • Computing services offered either over the Internet or a private internal network
    • Only available to select users no the general public


* Describe disadvantages of storing data on a public cloud compared to storing data on a server in a Local Area Network(LAN).

  • There could be a possible loss of control unlike the LAN

    • because the data is stored on someone else’s infrastructure
    • reliance on external agency to complete tasks
  • Requirements reliable Internet connection

  • Increased recurring costs



Ethernet

* Describe what is meant by Ethernet

  • A protocol suite
  • for data transmission in wired cables
  • uses CSMA/CD for collision detection
  • Data is transmitted in frames



Purpose of hardware

Switch:

  • Allow to or more devices to communicate with one another
  • To connect individual devices to each other
  • To receive transmissions and forward them to their destination.

Bridge:

  • To connect two LANs with the same protocol
  • To transmit data between two networks with the same protocol

Use of LAN

* Why in a single building it is better to set up LAN rather than WAN?

  • Small geographical area
  • No leasing to external structures

主要要点是不需要依赖上级的网络基础设施。



Wireless Network Interface Card(WNIC)

* Describe the functions of a WNIC.

  • Provide interface to wireless network as an antenna
  • Receives analog radio waves and convert then into binaries
  • Checks incoming transmissions for correct MAC/IP address and ignore transmissions not intended for it.
  • Encrypt / encode the data
  • Decrypt / decode the data
  • Takes digital input and converts to analog waves and send them out with an antenna.


Wireless Access Point(WAP)

  • Hardware component that provides radio communication from the central device to nodes on the network.



第三章:硬件

* Describe what is meant by an embedded system.

  • Microcontroller within a larger system which performs one specific task.


电阻式触摸屏没有5层那么多。一般来讲在AL计算机里,电阻式触摸屏只有两层。


* Describe how data is transmitted through a USB port

  • 1 bit transferred at a time
  • Can be synchronous or asynchronous



RAM

* Describe using DynamicRAM instead of Static RAM

  • Dynamic RAM has lower cost per unit
  • When a fast access speed is not needed
  • More data can be stored per chip


* Explain why Static RAM is used in the laptop instead of Dynamic RAM

  • Static RAM has faster access time
    • because it does noe need to be refreshed
    • used on the CPU for improvement of CPU cache speed



第四章:逻辑门与逻辑电路

画逻辑门图像时,如果两条线相交,需要在交点处画点 .。如果条件中出现了0和1,那么条件为0的那一个对应项加一个NOT



第五章:处理器基本原理

Von Neumann model

Stored program concept: Instructions and data are stored in the same memory space.

Parts of the Von Neumann model:

  • Registers
  • Buses
  • Control Unit(CU)
  • Arithmetic and Logic Unit(ALU)
  • Immediate Access Store(IAS)
  • System clock



Buses

* Identify types of signals that a control bus can transfer

  • Timing
  • Interruption
  • Read
  • Write


* Explain how control unit, system clock and control bus operate to transfer data between the components of the computer system.

  • The system clock will give out timing signals
    • which are being sent on the control bus
    • to sync all the other system components
  • The control unit initiates data transfer
    • by generating signals that are sent on the control bus to other components


* Describe the roles of the address bus, the data bus and buffers in the process of writing data to the optical disc reader/writer

  • Buffer:

    • Temporarily holds data until it is ready to be transmitted to the device
  • Address Bus:

    • Carries the address of the data to be written to the device.
  • Data Bus:

    • All data to be written to the device is carried on the databus.


* How the laser printer makes use of a buffer.

  • The print instructions and data are being sent into the buffer
  • The data is transferred from the buffer to the printer at the printer’s speed.
    • allow users to continue use the laptop.
    • instead of waiting for response of the slow printer
  • When the buffer is empty an interrupt is sent to the laptop




Fetch-Execute cycle

* Complete the following descriptions of internal components of a computer by writing the missing terms.

  • The Control Bus transmits the signals to coordinate events based on the electronic pulses of the system clock.

  • The data bus carries data to the components, while the address bus carries the address where data needs to be written to or read from.

  • The Arithmetic Logic Unit / ALU performs mathematical operations and logical comparisons.


* Define the role of registers in the Fetch-Execute cycle.

  • Program Counter (PC) holds the address of the next instruction and the contents will be incremented.
  • Memory Address Register (MAR) holds the address to fetch the data from PC.
  • Memory Data Register (MDR) holds the data at the address in the MAR.
  • the fetched instructions will be transferred to Current Instruction Register (CIR) for decoding and execution.


F-E Cycle and Interruption

* Describe when interrupts are detected in the F-E cycle and how the interrupts are handled.

  • Interruption will be detected at the start/end of the F-E cycle.
  • the priority will be checked.
  • if the priority is low then continue F-E cycle
  • if else, the current process will be stored on a stack
  • the location of the interruption will be detected
  • an appropriate ISR will be called to handle the interrupt
  • when the ISR finished, check for further interrupts and return to step 1
  • otherwise load data from the stack and continue the process


* Describe the purpose of an interrupt in a computer system.

  • to send a signal from a device or process
  • … seeking the attention of the processor


* State two causes of a software interrupt

  • Division by zero
  • Attempt to access an invalid memory location
  • Array index out of bounds
  • stack overflow



Register

Program Counter(PC): Store the address of the next instruction to be fetched

Memory Address Register(MAR): store the address of the memory location currently being read from

Index Register(IX): To store a value that is added to an address to give another address or Store a value used for indexed addressing.

Status Register(SR): Store bits that are either set or cleared which can be referenced individually.


* Describe the purpose of the Control Unit(CU) in a CPU

  • to coordinate the actions of other components in the CPU
  • to send / receive control signals along the control bus
  • to manage the execution of the instructions
  • to control the communication between the components of the CPU



Register transfer notation

    MAR ⬅ [PC], The contents of the PC are copied to the MAR

    PC ⬅ [PC] + 1;, Address in PC in incremented

    MDR ⬅ [[MAR]], The data held in MAR is copied to the MAR

    CIR ⬅ [MDR]

注意了,一定是MAR中的内容传输到MDR!有且仅有这一步是带双括号的。



* How clock speed impact the speed of the computer?

  • Each instruction in executed on a clock pulse.
    …so the clock speed dictates the number of instructions that can be run per second
  • The faster the clock speed the more instructions can be run per second.


见到clock speed,就需要结合instruction答题。




第六章:汇编语言程序设计


LSR 和 LSL 分别是向右和向左逻辑移位。

假设我们逻辑移位的位数为n:

向右逻辑移位会使得值变小,或者说:The value will be divided by 2n.
向左逻辑移位会使得值变大,或者说:The value will be multiply by 2n.


Trace table里面如果有指令对内存地址中的值做了处理,但是值没有更新。这种情况下就不需要在表格中再写一遍了。



第七章:控制与监控系统

* A fridge has to control the temperature of a chamber between 4 to 6 degree Celsius.
Explain why the system in the refrigerator is a control and not a monitoring system.

  • Control system is system uses feedback.
  • Since the microcontroller has to turn on the cooling system depending on the environment, the system is a control system > because it causes action.



* Explain the importance of feedback in a control system.

  • to ensure the system operates with the given criteria
  • … by enabling system output to affect subsequent system input
  • … thus allowing conditions to be automatically adjusted

第八章:系统软件

Operating system

* Identify key management tasks that the Operating System will perform.

  • Memory management
  • File management
  • Security management
  • Hardware / device / resources management
  • Input/Output management
  • Process management
  • error checking and recovery
  • provision of a platform for software
  • provision of a user interface


* Describe the key management tasks of an operating system.

  • Memory management

    • Controls the movement of the data between RAM, processor, VM
    • allocates memory to processes
  • File management

    • Creates files/folders
    • Renames file/folders
  • Security management

    • Creates accounts/passwords
    • Provide/upgrade firewalls / anti-malware
  • Hardware management

    • Receives data from input devices
    • sends data to output device
    • Use of device drivers
  • Process management

    • Decides which process to run next
    • Supports multitasking



Process management

* Describe how the Operating System manages processes in the computer

  • Decide which order to run the processes
  • Manages which resources that the process requires
  • Prevents interference between processes
  • Allow multi-tasking
  • Handling priorities and interruptions



Device management

* Describe how the OS manages the peripheral hardware devices of the computer.

  • Installs hardware drivers
    • to allow communication between computer and devices
  • Sends data and receives data to and from an input device / output device
  • Handles buffers
    • to ensure smooth transfer between devices that transmit and receive at different speeds
  • Manage interrupts



File management

* Describe the file management tasks that an Operating System performs

  • Storage space is divided into file allocation units
  • Space is allocated too particular file
  • Create directory structures
  • Specifies the logical method od the file storage
  • Provides file naming conventions



Memory management

* Describe the ways in which memory management organises and allocates Random Access Memory (RAM).

  • RAM is assigned into blocks
  • dynamic allocation of RAM to processes
  • reclaims unused blocks of RAM
  • prevents two process occupying the same area of RAM at the same time
  • moves data from secondary storage when needed



System clock

* Describe the purpose of the system clock

  • sync operations bu creating time signals
  • to keep track of the date and time
  • to process operations in the correct order



Compiler and Interpreter

* Drawbacks of using a compiler compared to an interpreter:

  • large amount of source code takes time to compile
  • errors cannot be corrected in real-time
  • the program will not run if there are any errors
  • cannot easily test specific sections of the source code


* Why high-level language programs might be partially compiled and partially interpreted:

  • partially compiled programs can be used on different platforms as they are interpreted to run.
  • code is optimised for the CPU as the machine code is generated at run time.


* Advantages for programmers to use Interpreters and Compilers:

  • Interpreters

    • Allow the developers to make real-time changes
      • so the program can be tested at each stage
      • the effects of the changes can be seen immediately
    • The developers can test the program even if it is not complete
      • so small parts of the program can be tested without testing the whole program
  • Compilers

    • The developer can debug multiple errors simultaneously
    • Produces an executable file
      • so that developer can test the program multiple times without recompiling



Program library

* Describe how a program library can be used while writing a computer program.

  • Program libraries store pre-written functions and routines
  • The program library can be imported to the program
  • The routines can be call in the program


* Explain the benefits to the programmer of using program libraries.

  • Save programming and testing time as code does not have to re-written from scratch.
  • Code is already tested so it is more robust.
  • If there is an update in the library routine the program will be updated automatically.
  • can perform complex calculations that the programmer may not be able to do.



* State benefits to a programmer of using Dynamic Link Library(DLL) files.

  • Memory requirements for program are reduced as dynamic link library is loaded only once
  • The executable file size is smaller because the executable does not contain all the library routines
  • Maintenance not needed to be done by the programmer because the DLL is separate from the program
  • No need to recompile the main program when changes are made to DLL because changes correction to the DLL file code are done independently of the main program



Buffer

* Explain the purpose of buffer in a computer system using one example.

  • To act as a temporary storage before it is used by the receiving device
  • to allow processes to operate at different speeds

  • video buffer when streaming videos

  • keyboard buffer when performing data entry
  • printer buffer used when data is transferred from a computer to printer



Embedded system

* Explain the reasons why ROM is used in an embedded system

  • ROM is used to store data that no change
  • data must be stored even when the device is without power
  • to store boot up instructions


* Explain what is an embedded system.

  • Dedicated to one task
  • Does not require much processing power
  • Built into a larger system
  • Contains firmware that cannot be easily updated
  • The system does not have its own operating system
  • An embedded system must contain a processor, memory and I/O capability



Utility software

Back-up software:

  • Make copy of data at regular intervals.
  • So that if it is lost it can be retrieved.

Defragmentation software:

  • Make individual files to free space together
  • Improve disk access times


* Why a hard disk formatter is needed for the new disk.

  • Disk needs to be initialized
  • Disk need to be error-checked
  • A new file system needs to be generated on the disk
  • The file allocation table needs to be set up



第九章:安全、隐私和数据完整性

Data security, integrity, privacy

Data security: Protects data against loss.

Data privacy: Protects data against unauthorised access.

Data integrity: Ensuring the consistency / accuracy of the data.


Data validation, verification

Data validation: Validation checks that data is reasonable / sensible.

Data verification: Verification checks that data is the same as the original.



Types of validation check:

  • Presence check: 样式检查,用来检查输入的内容是否是空的。
  • Format check: 格式检查,来检查输入的数据是否符合要求的格式(比如日期的格式就必须是 dd/mm/yyyy )。
  • Length check: 长度检查,用来检查数据是否符合应有的长度。比如说用来检查输入的电话号码是否是11位。
  • Range check: 范围检查,用来检查输入的数据是否在合法范围内。
  • Limit check: 限制检查,检查输入的数据是否突破了一个阈值。
  • Type check: 数据形式检查,用来检查输入的数据形式是否合法。(比如说构成日期的每一位数据都必须是正整数,不能是小数。)
  • Existence check: 存在性检查,检查输入的内容是否已经出现过,或者检查输入的内容是否在一个列表内。比如说在同一个文件夹下将一个文件重命名成另一个文件的样子会报错,是因为存在Existence check。



Threats

* Difference between pharming and phishing

  • Difference:

    • Pharming is malicious code that redirects to a fake website. Phishing uses an email to prompt user action
    • Pharming is automatic. Phishing requires user action
  • Similarity:

    • Both try to obtain financial or personal information
    • Both are a false representation of an official organization
    • Both make use of fake websites



第十章:道德与所有权

* Describe what is meant by copyright.

  • The formal and legal rights to ownership.
  • Protects against unauthorised reproduction of work.
  • Provides for legal right of redress


* Explain benefits to a programmer of distributing a program using a shareware license

  • Users can trial the program and give constructive feedback
  • More people might try the program because the trial is free of charge
  • Allow bugs to be founded and corrected on a wide range of computer
  • The programmer may get income if users purchased the program
  • Allow the program be protected by copyright.



About ethics

* Describe the benefits of joining a professional ethical body.

  • Has ethical guidelines to follow
    … so clients / other staff know the standards being applied
    … so he does not have to decide what is ethical it’s written down

  • Clients / staff know other person in the group is reputable
    … recognition of his skills / knowledge
    … there might be requirements for entry

  • They provide help and support
    … for instance if he needs legal advice

  • They run training courses
    … to keep his skills up-to-date


* A person is unfamiliar with the IDE he is required to use. Describe the ways in which this person can act ethically in this situation.

  • He can tell the manager he has not used it
  • He can perform his own research on how to use it
  • He can explain to the manager that he needs additional training
  • He can ask for a mentor
  • He can practice at home before starting


* Why hiding bugs from other group member is unethical?

  • He did not act in best interest of product
    … because the product might fail because he did not report the error

  • He did not act in best interest of clients
    … because if the product does not work then they have been let down because he did not report the error

  • He did not act in best interest of the profession
    … he is letting his profession down because he did not report the error

  • He did not act in best interest of the company
    … not correcting the error could lead to later problems



* Describe why it is important for a developer in a software developer team acts ethically in relation to her team members.

  • To make sure the team members feel valued
  • To get the best work out of the team
  • To enable them to work well together
  • To enable them to create the best product for the client



* Describe how computer would use Artificial Intelligence (AI) to play a board game (e.g. chess).

  • The decision making algorithms of the game will be stored.
  • The AI program is trained, by playing many times.
  • AI will look (ahead) at possible moves
    …analyse the pattern pf past choices
    …and choose the move most likely to be successful
  • Computer could learn how to improve // learn from previous mistakes
    …by storing the positive/negative result of choices
    …and changing its future choices.



Characteristics of software

Statement Free Software Foundation Open Source Initiative Shareware > Commercial Software
The user can edit the source code
The user must always pay before being able to use the software
The user can redistribute the software
The user always gets a trial period



第十一章:数据库

* Explain why relational database is usually better than a file-based database.

  • Flat file has more data redundancy.
    …because the same data is stored many times.

  • Flat file has worst data integrity.
    …because duplicate data might be stored differently.
    (when data is updated in one place, it is not updated everywhere)

  • Hard to perform complex searches.
    …because a new program built for searching data has to be written each time depending on searching requirement.

  • Flat-file could have lack of privacy.
    …as user views cannot easily be implemented.

  • There is a program-data dependency with flat-files.
    …because any changes to the structure of the flat-files means the program that access to the data has to be re-written.



* Describe the ways in which access rights can be used to protect the data in a database from unauthorised access.

  • Access rights give managers access to different elements
    … by having different accounts / logins
    … which have different access rights

  • Specific views can be assigned to himself and to the managers
    … managers can only see the data for their own shops



如果一个表包含另一个表的主键,注意包含的意思是即便这个主键在另一个表内不是键也可以,那么这个包含另一个表主键的表就是关系的维护者,进而这个表表示的就是多,另一个表就是一。



Data dictionary

* Describe the purpose and contents of the data dictionary in the DBMS

  • Data dictionary stores metadata of the database / stores information about the data stored.
  • table name
  • field name
  • data type
  • type of validation
  • Primary key
  • Foreign key
  • relationships



Logical schema

* Describe what is meant by a Logical schema:

  • is the overview of a database structure, a model of a database that is not specific to one DBMS.
  • models the problem and situations
  • by using methods like E-R diagrams.



Query processor

* Describe the purpose of a query processor in a DBMS

  • Allow users to enter criteria
  • searches for the data that meets the entered criteria
  • organises the results to be displayed to the user



Data integrity in DBs

  • Validation and verification rules
  • If one table is updated all the tables are updated.


* Why referential integrity is important in a DB?

  • Make sure that data is consistent
  • Make sure all the data is up-to-date
  • Make sure all the foreign key has a correspond primary key
  • Make sure queries can return accurate results



Common definitions about database:

Field: A column / attribute in a table.

       For instance:
      CUSTOMER(CustomerID, FirstName, LastName, DateOfBirth, Email)
      A field is CustomerID in the table CUSTOMER


Entity: Anything that data can be stored about.

       For instance: A customer in the last example table.


Primary Key: The unique attribute used to identify the record.


Foreign Key: An attribute which is linked to primary key in other table.

       No hints will be provided as this is too basic.


Secondary key: a candidate key that has not been chosen as the primary key.


Tuple: A single row in a table.

       No hints will be provided as this is too basic.



Composite primary key

* Explain why the table has a composite primary key

  • Neither key uniquely identifies each tuple by itself.
  • One element cannot appear in the same file twice so together they are unique.



Access rights

* Describe the ways in which access rights can be used to protect the data in the database from unauthorised access.

  • Access rights give managers access to different elements
  • … by having different accounts
  • … which have different access rights, (read only, no access, read and write)
  • Specific views can be assigned to himself and to the managers
  • … e.g. managers can only see the data for their own shops.

简单来讲就是分级别的账户管理。


Conditions to 3 normal forms:

3NF: All fields in all tables are dependent fully on the primary key and no other partial dependencies.


上面的是满足三个范式的描述,分开的描述如下:

1NF: No repeating groups.
2NF: No partial dependencies, fully dependent on the primary key.
3NF: No non-key dependencies.


Data Definition Language (DDL) manipulation.

RENTAL(RentalID, CustomerID, HouseID, MonthlyCost, DepositPaid)

* Complete the following Data Definition Language (DDL) statement tp define the table RENTAL.

1
2
3
4
5
6
7
8
CREATE TABLE RENTAL(
RentalID INTEGER NOT NULL,
CustomerID INTEGER NOT NULL,
HouseID VARCHAR(5) NOT NULL,
MonthlyCost REAL NOT NULL,
DepositPaid BOOLEAN NOT NULL,
PRIMARY KEY (RentalID)
);


* Write an SQL script to count the number of films that were released in Jan. 2022

1
2
3
SELECT COUNT(FilmID)
FROM FILM_FACT
WHERE ReleaseDate = "January 2022";

SQL语句结尾记得加上分号。


可变长度字符串使用VARCHAR数据类型表示。字符串的长度需要在括号中定义。

浮点型使用REAL数据类型表示。与VARCHAR不同,REAL不需要在括号中定义长度。



Data Manipulation Language (DML) manipulation

CUSTOMER(CustomerID, FirstName, LastName, DateOfBirth, Email)
HOUSE(HouseID, HouseNumber, Road, Town, Bedrooms, Bathrooms)
RENTAL(RentalID, CustomerID, HouseID, MonthlyCost, DepositPaid)

* Write a Data Manipulation Language (DML) script to return the first name and last name of all customers who have not paid their deposit. If a customer has not paid their deposit, the value of DepositPaid will be No.

1
2
3
4
SELECT FirstName, LastName
FROM CUSTOMER, RENTAL
WHERE DepositPaid = 'No'
AND RENTAL.CustomerID = CUSTOMER.CustomerID;


* Complete a DML statement to include the information in the table CAR.

1
2
INSERT INTO CAR
VALUES ("123AA","Tiger","Lioness",10500,"12BSTREET")

插入数据使用INSERT INTO, VALUES。


* Complete the DML statements to return the number of cars for sale in each shop.

1
2
3
SELECT COUNT (RegistrationNumber)
FROM CAR
GROUP BY ShopID

见到了each,就大概率需要分组输出了
分组输出就要先选择输出对象,然后使用GROUP BY约束分组条件。



Structured Query Language (SQL) scripts

* A database has the following structure:

       STUDENT(StudentID, FirstName, LastName)
       TEST(TestID, Description, TotalMarks)
       STUDENT_TEST(StudentID, TestID, Mark)

Sample data to be stored in the table STUDENT_TEST is shown:

StudentID TestID Mark
12 A1 50
12 P10 100
13 A1 75
14 P10 60

Write a Structured Query Language (SQL) script to create the table STUDENT_TEST.


1
2
3
4
5
6
7
8
CREATE TABLE STUDENT_TEST(
StudentID INTEGER,
TestID VARCHAR,
Mark INTEGER,
PRIMARY KEY(StudentID, TestID),
FOREIGN KEY(TestID) REFERENCES TEST(TestID),
FOREIGN KEY(StudentID) REFERENCES STUDENT(StudentID),
);

* Write a Structured Query Language (SQL) script to find the average mark of students in test A7.

1
SELECT AVG(Mark) FROM STUDENT_TEST WHERE TestID = "A7"


* Complete the SQL script to return the number of devices stored in the database for the staff member with the first name “Ali” and the last name “Khan”.

1
2
3
4
5
6
SELECT COUNT(STAFF.StaffID)
FROM STAFF
INNER JOIN DEVICE
ON STAFF.StaffID = DEVICE.StaffID
WHERE STAFF.FirstName = 'Ali'
AND STAFF.LastName = 'Khan';

INNER JOIN的格式是 INNER JOIN, ON
如果需要并列WHERE条件可以使用AND比较符。


* Complete the SQL script to display the total number of photographs that have been taken using a camera ID starting with CAN

1
2
3
SELECT COUNT(PhotoID)
FROM PHOTO_DATA
WHERE CameraID LIKE "CAN%";

首先见到数number就使用COUNT语句。
其次,部分匹配搜索约束语句使用 LIKE "___%",百分号表示之后的内容可以不匹配。


* Write an SQL script to include two new fields in CAMERA_DATA to store the number of photographs currently on the camera and the date the camera was last used.

1
2
3
ALTER TABLE CAMERA_DATA
ADD Number_Of_Photos INTEGER
ADD Lastused DATE;

向表内加入attribute的格式是ADD <attribute_name> <data_type>

<attribute_name><data_type>之间不需要加TYPE



PART TWO:基本问题的解决与编程技能

第十二章:算法设计与解决问题

第十三章:数据类型与结构

第十四章:编程与数据的表示

第十五章:软件开发

PART THREE: 进阶理论

第十六章:数据的表示

User defined datatype:

Data type constructed by the programmer
Data type that references at least one other datatype
… the data types can be primitive or user defined.
e.g.: class



Enumerated data type:

  • a list of possible data values
  • The values defined here have an implied order of values to allow comparisons to be made.

DECLARE <identifier> = (<value1>, <value2>, ..., <valuen>)


DECLARE AccessionNumber : ARRAY[1:NumberOfCopies] OF INTEGER



Files:

Serial files:

  • Contains records that have no defined order.
  • Can be used for:
    • Batch processing
    • Backing up data on magnetic tape
    • Banks record transactions involving customer accounts everytimg there is a transaction

Sequential files:

  • Has records that are ordered and is suited for long term storage of data and thus is considered an alternative to a database.

Direct access / random access files:

  • Access isn’t defined by a sequential reading of the file.
  • Well suited for larger files as it takes longer to access sequentially.



第十七章:通讯及互联网技术

Circuit switching and Packet switching:

Circuit switching:

  • A dedicated circuit
  • circuit is established before transmission starts
  • data is transferred using the whole bandwidth
  • all data is transferred over the same route

  • Advantage: data arrive in order do not need to be rearranged

  • Disadvantage: nobody else can use the same circuit even it is idle

Packet switching:

  • data is split into packets
  • each packet is given its own route
  • the routing for a packet depends on the congestion
  • packets may not arrive in order

  • Advantage: packets can be rerouted if there are any problems

  • Disadvantage: time taken to reassemble packets at the destination



Protocol: A set of rules governing communication between computers

MAC Address: A unique number assigned to each device’s networking hardware across the world

IP Address: A unique number assigned to each node/networking device in a network


Layer of Networking:

Application: Encode the data being sent

Network/Internet: Adds IP addresses stating where the data is from and where it is going

Link: Adds MAC address information to specify which hardware device the message came from and which hardware device the message is going to

Physical: Enables the successful transmission of data between devices



Transmission Protocols:

HTTP: Handles transmission of data to and from a website.

FTP: Handles transmission of files across a network.

POP3: Handles the receiving of emails.

SMTP: Handles the sending of emails.



Transport Layer Security (TLS)

Purpose:

  • Provide for secure communication over a network
  • maintain data integrity
  • add an additional layer of security
  • Provides improved security of SSL



Topologies

Bus topology: A network topology in which each workstation is connected to a main cable (backbone).

Star topology: A network topology in which each workstation is connected to a central node

Wireless networks: A computer network that uses wireless data connections between its network components



Devices

Switch: Allows different networks to connect

Router: Directs the incoming packets

Servers: Provides a medium for the storage, sharing of usage of files and applications for its users

Network Interface Cards(NICs): Consists of the electronic circuitry required to communicate with other networks and devices



Networking

Ethernet: An array of networking technologies and systems used in local area networks (LAN), where computers are connected within a primary physical space.



第十八章:硬件与虚拟机

Virtual memory

* Explain what is meant by virtual memory.

  • A place on secondary storage used to extend the size of the RAM.
    … so the CPU can access to larger size of the RAM
  • Only when the data is required to be in the main memory will be swapped from virtual memory to the main memory
  • Virtual memory is created temporarily.



CISC & RISC

* Describe what is meant by RISC processors:

  • Uses simple instructions
  • Uses fixed length instructions
  • Instructions only require one clock cycle
  • Uses many registers
  • Hardwire CU


* Describe what is meant by CISC processors:

  • Uses many instruction formats
  • Uses variable length instructions
  • Makes use of different addressing modes
  • Uses few registers
  • Has a large instruction set
  • Requires complex circuits
  • Instructions may requires many clock cycles.


Pipelining:

  • Instruction level parallelism
  • Used extensively in RISC processor based systems to reduce the time taken to run processes
  • Multiple registers are employed.



Parallel processing

SISD:

  • Single instruction single data stream
  • Found in the early computers
  • Contains multiple processors, which have their own memory


SIMD:

  • Single instruction multiple data stream
  • Found in array processors
  • Contains multiple processors, which have their own memory


MISD:

  • Multiple Instruction Single data stream
  • Used to sort large quantities of data
  • Contains multiple processors which process the same data


MIMD:

  • Multiple Instruction Multiple Data
  • Found in modern personal computers


Massively parallel computers:

  • Computers that contain vast amounts of processing power
  • Has a bus structure to support multiple processors and a network infrastructure to support multiple ‘Host’ Conputers
  • Commonly used to solve highly complex mathematical problems



第十九章:逻辑门与布尔代数

Boolean Algebra

Identity / Law AND form OR form
Identity 1.A = A 0 + A = A
Null 0.A = 0 1 + A = 1
Idempotent A.A = A A + A = A
Inverse A.Ā = 0 A + Ā = 1
Commutative A.B = B.A A + B = B + A
Associative (A.B).C = A.(B.C) (A + B) + C = A + (B + C)
Distributive A + B.C = (A + B).(A + C) A.(B + C) = A.B + A.C
Absorption A.(A + B) = A A + A.B = A
De Morgan’s
Double Complement ̿A = A ̿A = A



Half-Adder: A logic circuit that adds two bits together and outputs their sum.



第二十章:系统软件

Multitasking

Process states:

  • Ready: New process arrived at the memory and the PCB is created
  • Running: Has CPU access
  • Blocked: Cannot progress until some event has occurred



Virtual Memory

  • No need for all pages to be in the memory
  • CPU address space thus larger than physical space

    • Address resolved by memory management unit
  • Benefits:

    • Not all of the program has to be in memory at once
    • Large programs can be run with or without large physical memory
  • Process:

    • All pages on disk initially
    • One / more loaded into memory when process is ‘ready’
    • Pages replaced from disk when needed
      • Can be done with FIFO queue or usage-statistics based algorithm


Disk thrashing: Perpetual loading / unloading of pages due to a page from disk immediately requiring the page it replaced.



Backus Naur Form

<Identifier>::=<Letter>|<Identifier><Letter>|<Identifier><Digit>
<Digit>::=0|1|2|3|4|5|6|7|8|9
<Letter>::=<UpperCaseLetter>|<LowerCaseLetter>
<UpperCaseLetter>::=A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z
<LowerCaseLetter>::=a|b|c|d|e|f|g|h|i|j|K|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z

在巴科斯范式中,|为了分离单独的每一个选项,::=可以被描述成“被定义为”。
在上面的例子中,<Identifier>是使用递归的方式定义的。但如果我们要定义的内容无法抽象到这个级别,那么我们也可以使用列举的方式定义内容。



第二十一章:数据安全

Key and encryption

* What is meant by a private key?

  • An unpublished key which has a matched public key
  • Will be used with a matched public key to decrypt the data encrypted with that public key.


* What is asymmetric encryption?

  • Message sent is being encrypted using public key.
  • The message is being decrypted using the receiver’s private key.

* What is symmetric encryption?

  • When there is just one key which is used to encrypt and decrypt the information
  • The key is shared by the sender and the receiver of a message


Quantum encryption

* State benefits of using quantum cryptography

  • Integrity of the key once is transferred can be guaranteed
  • More secure keys can be exchanged
  • Any eavesdropping (窃听) can be identified

* State drawbacks of using quantum cryptography

  • Limited range
  • requires dedicated fibre optic line and specialist hardware
  • cost of dedicated fibre optic line and specialist hardware is expensive
  • polarization of the light may be altered during transmission



Malware

Worm: runs independently and propagates to other network hosts

Spyware: collects info & transmits to another system

Phishing: email from seemingly legit source requesting confidential info

Pharming: Setting up a bogus website that appears to be legit



第二十二章:人工智能 (AI)

PART FOUR: 进阶编程技能与问题解决

第二十三章:算法

Big O notation

* Describe the meaning of O(log n) as it applies to a binary search algorithm.

  • O(log n) is the time complexity that uses logarithm time
  • The time taken goes up linearly as the number of items rises exponentially
  • O(log n) is the worst case scenario.

第二十四章:递归

第二十五章:编程范式

OOP:

Properties:

  • the data items and attributes
  • the data types and characteristics
  • defined in a class

Methods:

  • the functions and procedures stored in a class which acts on the properties

Inheritance:

  • Methods and properties contained in one class are made to be available to another class



作者

ntcs

发布于

2024-02-25

更新于

2025-01-26

许可协议

# 相关文章
  1.A2CS笔记
  2.ASCS笔记
# 推荐文章
  1.邈想日集
  2.ENGG1340笔记
  3.ASCS笔记
  4.A2CS笔记
  5.浅谈今年CAIE的POE考试
  6.收集"你说得对"

评论